﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Processors;
using Microsoft.Xna.Framework.Graphics;

namespace ContentPipelineExtensions
{
    [ContentProcessor]
    public class DudeDiffuseProcessor : TextureProcessor
    {
        public override Microsoft.Xna.Framework.Content.Pipeline.Graphics.TextureContent Process(Microsoft.Xna.Framework.Content.Pipeline.Graphics.TextureContent input, Microsoft.Xna.Framework.Content.Pipeline.ContentProcessorContext context){
           
            for (int j = 0; j < input.Faces[0].Count; j++){
                var data = input.Faces[0][j].GetPixelData();
                for (int i = 0; i < data.Length; i += 4){
                    //Array.Reverse(data, i, 4);
                    //Array.Reverse(data,i+1,3);
                    data[i + 3] = 255;

                    //var oldA = data[i];
                    //data[i] = data[i + 1];
                    //data[i + 1] = data[i + 2];
                    //data[i + 2] = data[i + 3];
                    //data[i + 3] = oldA;
                }
                input.Faces[0][j].SetPixelData(data);
            }
            return base.Process(input, context);
        }
    }
}
